<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="java.net.URLDecoder"%>
<%
String STAFF_SN=Tool.getRequest("STAFF_SN",request);//必传参数
String STAFF_NAME=Tool.getRequest("STAFF_NAME",request);//必传参数
String SEXMARK=Tool.getRequest("SEXMARK",request);//必传参数
String STAFF_ID=Tool.getRequest("STAFF_ID",request);//必传参数
String STAFF_TEL=Tool.getRequest("STAFF_TEL",request);//必传参数
String SQUADRON_NO=Tool.getRequest("SQUADRON_NO",request);//必传参数
String UNIT_NO=Tool.getRequest("UNIT_NO",request);//必传参数
String POSITION=Tool.getRequest("POSITION",request);//必传参数
String A320V2500_POST=Tool.getRequest("A320V2500_POST",request);//必传参数
String A330RRT700_POST=Tool.getRequest("A330RRT700_POST",request);//必传参数
String A320V2500_PASS=Tool.getRequest("A320V2500_PASS",request);//必传参数
String A330RRT700_PASS=Tool.getRequest("A330RRT700_PASS",request);//必传参数
String A320V2500_ENGINE=Tool.getRequest("A320V2500_ENGINE",request);//必传参数
String A330RRT700_ENGINE=Tool.getRequest("A330RRT700_ENGINE",request);//必传参数
	
String list="";

UserService user = (UserService) session.getAttribute(SysConstant.SESSION_NAME);//获得session里面的登陆信息
if(1==2){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		DBManager db = new DBManager();	
	    if("".equals(STAFF_SN)){//insert 
	   		String sql = "insert into STAFF_INFO (STAFF_ID,STAFF_NAME,SEXMARK,STAFF_TEL,SQUADRON_NO,UNIT_NO,POSITION,A320V2500_POST,A330RRT700_POST"+
	   						" ,A320V2500_PASS,A330RRT700_PASS,A320V2500_ENGINE,A330RRT700_ENGINE,PASSWORD,is_admin) "+
	   						" values "+
	   						" ('"+STAFF_ID+"','"+STAFF_NAME+"',"+SEXMARK+",'"+STAFF_TEL+"','"+SQUADRON_NO+"','"+UNIT_NO+"','"+POSITION+"'"+
	   						" ,"+A320V2500_POST+","+A330RRT700_POST+","+A320V2500_PASS+","+A330RRT700_PASS+","+A320V2500_ENGINE+","+A330RRT700_ENGINE+
	   						",'111111','0')";//初始密码111111	
			db.update(sql);
	    }else{
	    	String sql = "update  STAFF_INFO set STAFF_ID='"+STAFF_ID+"',STAFF_NAME='"+STAFF_NAME+"',SEXMARK="+SEXMARK+","+
	    					"	STAFF_TEL='"+STAFF_TEL+"',SQUADRON_NO='"+SQUADRON_NO+"',UNIT_NO='"+UNIT_NO+"',POSITION='"+POSITION+"'"+
	    					" ,A320V2500_POST="+A320V2500_POST+",A330RRT700_POST="+A330RRT700_POST+",A320V2500_PASS="+A320V2500_PASS+
	   						" ,A330RRT700_PASS="+A330RRT700_PASS+",A320V2500_ENGINE="+A320V2500_ENGINE+",A330RRT700_ENGINE="+A330RRT700_ENGINE+
	   						"  where  STAFF_SN="+STAFF_SN;
	   							
			db.update(sql);
	    }
		
		
	    
		list="{\"id\":100}";
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
